import { CaseLevel, IsEnable, SignType } from '../project-builder/models/constants';

/**
 * 测试用例相关选项
 */
export interface TestTaskOption {

  /**
   * 测试用例级别
   */
  caseLevel: CaseLevel;

  /**
   * 是否签名
   */
  sign: SignType;

  /**
   * 是否安装ohpm
   */
  ohpmInstall: IsEnable;
}

/**
 * 测试用例选项默认值
 *
 */
export const defaultTestTaskOption: TestTaskOption = {
  caseLevel: CaseLevel.L0,
  sign: SignType.NoSign,
  ohpmInstall: IsEnable.DisAble
};

/**
 * 测试用例选项构建类
 */
export class TestTaskOptionBuilder {
  private readonly _option: TestTaskOption;

  private constructor() {
    this._option = { ...defaultTestTaskOption };
  }

  public static builder(): TestTaskOptionBuilder {
    return new TestTaskOptionBuilder();
  }

  public static defaultOpt(): TestTaskOption {
    return { ...defaultTestTaskOption };
  }

  caseLevel(caseLevel: CaseLevel) {
    this._option.caseLevel = caseLevel;
    return this;
  }

  sign(sign: SignType) {
    this._option.sign = sign;
    return this;
  }

  ohpmInstall(ohpmInstall: IsEnable) {
    this._option.ohpmInstall = ohpmInstall;
    return this;
  }

  build() {
    return this._option;
  }
}


